package com.yixun.interceptor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorAdapter implements WebMvcConfigurer {

    private static final Logger LOGGER = LoggerFactory.getLogger(InterceptorAdapter.class);

    @Autowired
    private UrlInterceptor urlInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        LOGGER.info("Interceptor");
        registry.addInterceptor(urlInterceptor).addPathPatterns("/**").excludePathPatterns("/", "/login", "logout", "/captcha", "/error/**", "/static/**",
                "/goIndex", "/goSctj", "/goDytj", "/goPrice", "/goFarm", "/goSltj", "/goNewIndex",
                "/index/getPriceData", "/index/getPigOutData", "/index/getAnimalMaxData", "/show/goLogin","/file/**",
                "/goSyIndex","/show/getShowData","/show/**","/sys_pm/goDetail/**",
                "/visual/**");
    }
}
